package com.infore.statisticsAndAlarm.controller.metaAnalysis;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.infore.statisticsAndAlarm.service.TwoRateComparisonService;
import com.infore.statisticsAndAlarm.util.ResultEntity;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "综合分析---两率分析接口", tags = {"综合分析---两率对比分析接口" })
@RestController
@RequestMapping("/twoRateComparison")
public class TwoRateComparisonController {

	@Autowired
	private TwoRateComparisonService twoRateComparisonService;
	
	@ApiOperation(value="上传率排名列表")
	@ApiImplicitParams({@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "开始时间", name = "startTime", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "结束时间", name = "endTime", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "查询参数code", name = "queryCode", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "查询类型/area区域/basinn流域", name = "queryType", paramType = "query",required = true,dataType = "String")})
	@GetMapping(value = "/uploadRateReports")
	public ResultEntity uploadRateReports(String timeType,String startTime,String endTime,String queryCode,
			String queryType ,HttpServletRequest request){
		return twoRateComparisonService.uploadRateReports(timeType,startTime,endTime,queryCode,
				queryType, request);
	}
	
	@ApiOperation(value="上传率排名柱状图")
	@ApiImplicitParams({@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "开始时间", name = "startTime", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "结束时间", name = "endTime", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "查询参数code", name = "queryCode", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "查询类型/area区域/basinn流域", name = "queryType", paramType = "query",required = true,dataType = "String")})
	@GetMapping(value = "/uploadRateBars")
	public ResultEntity uploadRateBars(String timeType,String startTime,String endTime,String queryCode,
			String queryType,String userId,HttpServletRequest request){
		return twoRateComparisonService.uploadRateBars(timeType,startTime,endTime,queryCode,
				queryType, request);
	}
	
	@ApiOperation(value="上传率同比/环比")
	@ApiImplicitParams({@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "开始时间", name = "startTime", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "结束时间", name = "endTime", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "查询参数code", name = "queryCode", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "查询类型/area区域/basinn流域", name = "queryType", paramType = "query",required = true,dataType = "String"),
		@ApiImplicitParam(value = "同比H--环比", name = "compareType", paramType = "query",required = true,dataType = "String")})
	@GetMapping(value = "/uploadRateYoY")
	public ResultEntity uploadRateYoY(String timeType,String startTime,String endTime,String queryCode,
			String queryType,String compareType,String userId,HttpServletRequest request){
		return twoRateComparisonService.uploadRateYoY(timeType,startTime,endTime,queryCode,queryType,
				compareType,request);
	}
	
	@ApiOperation(value = "数据上传率/数据有效率表格")
	@ApiImplicitParams({
			@ApiImplicitParam(value = "类型可选valid/upload", name = "type", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "站点mn", name = "stationMn", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "开始日期yyyy-MM-dd HH:mm:ss", name = "sTime", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "结束日期", name = "eTime", paramType = "query", required = false, dataType = "String") })
	@GetMapping(value = "/dataValidUploadRate")
	public ResultEntity dataValidUploadRate(String type, String time, String stationMn, String sTime, String eTime) {
		return twoRateComparisonService.dataValidUploadRate(type, time, stationMn, sTime, eTime);
	}
}
